home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 September
/
Macworld (1998-09).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop 1.8.3
/
More Classes
/
File Classes
/
ZPrefsFile.cpp
< prev
next >
Wrap
Text File
|
1998-05-13
|
1KB
|
77 lines
/*************************************************************************************************
*
*
* MacZoop - "the framework for the rest of us"
*
*
*
* ZPrefsFile.cpp -- the prefs file object
*
*
*
*
*
* © 1996, Graham Cox
*
*
*
*
*************************************************************************************************/
#include "ZPrefsFile.h"
#include "MacZoop.h"
#include <folders.h>
static FSSpec gDummySpec = { 0, 0, "\p" };
ZPrefsFile::ZPrefsFile( Str255 fName )
: ZResourceFile( gDummySpec )
{
short foundVR;
long dirID;
OSErr theErr;
itsType = kPrefsFileType;
FailOSErr( FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &foundVR, &dirID ));
theErr = FSMakeFSSpec( foundVR, dirID, fName, &itsSpec );
if ( theErr == fnfErr )
CreateResFork();
else
FailOSErr( theErr );
}
ZPrefsFile::ZPrefsFile()
: ZResourceFile( gDummySpec )
{
short foundVR;
long dirID;
OSErr theErr;
itsType = kPrefsFileType;
FailOSErr( FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &foundVR, &dirID ));
// make the filename by using the app's name and appending "prefs" (STR#128/16)
Str255 fName;
Str31 pf;
gApplication->GetName( fName );
GetIndString( pf, 128, 16 );
ConcatPStrings( fName, pf );
theErr = FSMakeFSSpec( foundVR, dirID, fName, &itsSpec );
if ( theErr == fnfErr )
CreateResFork();
else
FailOSErr( theErr );
}